package mvc.controller;

import mvc.model.service.AddressService;
import mvc.model.service.impl.AddressServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "UpAddrServlet",urlPatterns = "/upAddr")
public class UpAddrServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String anumber = request.getParameter("anumber");
        AddressService addressService = new AddressServiceImpl();
        addressService.deletAddr(Integer.parseInt(anumber));
        response.getWriter().append("删除成功！");
    }
}
